{% extends 'overview/base.html' %}

{% block external %}
  {% load static %}
  <link rel="stylesheet" type="text/css" href="{% static 'css/users/login.css' %}"/>
{% endblock %}

{% block title %}
	找回密码
{% endblock %}

{% block main %}
	<div id="encrypted" class="container">
		<div class="row">
      <div class="col-sm-6 col-sm-offset-3">
        <form class="login-box" role="form" action="{% url 'users:retrieve-encrypted' user.id %}" method="post">
          {% csrf_token %}
          <!--开头的找回密码-->
          <div class="text-center">
            <h4>~找回密码~</h4>
          </div>
          <hr/>
          <!--用户名框，只做显示作用，不可更改-->
          <div class="input-group">
            <span class="input-group-addon"><span class="glyphicon glyphicon-user"></span></span>
            <input type="text" class="form-control" disabled value="{{ user.username }}"/>
          </div>
          <br/>
          <!--判断密保问题是否存在-->
          {% if user.question %}
            <input type="text" class="form-control" value="{{ user.question }}" disabled/>
            <br/>
            <input type="text" name="answer" class="form-control" placeholder="答案" value="{{ answer }}"/>
            {% if answer_error %}
              <p class="text-danger small">*{{ answer_error }}</p>
            {% endif %}
            <hr/>
            <button type="submit" class="btn btn-primary btn-block">下一步</button>
          {% else %}
            <p class="text-warning text-center">您似乎没有设置密保问题，很遗憾无法通过此方式找回密码！</p>
          {% endif %}
        </form>
      </div>
		</div>
	</div>
{% endblock %}